!

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="../../css/service.css" rel="stylesheet">
    <script src ="../../../configure.js"></script>
    <script src ="../../jquery/jquery-3.3.1.min.js"></script>
    <script src="../../layer/layer.js"></script>
    <link href="../../css/server-wjr.css" rel="stylesheet">
</head>
<body style="overflow:scroll;overflow-x:hidden;overflow-y:hidden">

<div class="express">
    <h2>运费时效查询</h2>
    <div class="price addPrice">
        <form>
            <div class="txtbox addTxtbox">
                <span>始发地：</span>
                <input id="start" type="text" placeholder="请选择省市区" >
            </div>
            <div class="txtbox">
                <span>目的地：</span>
                <input id="end" type="text" placeholder="请选择省市区" >
            </div>
            <div class="txtbox">
                <span>重量：</span>
                <input id="weight" type="number" placeholder="请输入不小于1的数" oninput="if( value < 1 ){value = '1'}">
            </div>
            <div class="txtbox">
                <span>寄件时间：</span>
                <input type="date" >
            </div>
            <!-- <p>不知道重量？请<em>点击此处</em>输入长宽高系统自动计算。</p> -->
            <div class="btn-submit">查询</div>
        </form>
        <div class="middle-right">

        </div>
    </div>
</div>
<script>
  
    $('.btn-submit').click(function(){
       
        let start = $('#start').val();
        let end = $('#end').val();
        let weight = $('#weight').val();
        
        if(start=="" || end==""){
            layer.msg("输入框数据不能为空")
            return false;
        }
        if(weight <1){
            layer.msg("重量不能小于1");
            return false;
        }
        
        $.ajax({  
           type: "POST",
           dataType: "json",
           url: url + "/page/selectByAreaAndWeight" ,//url
           data: {
               start:start,
               end:end,
               weight:weight
            },
            success: function (result) {
                console.log(result);//打印服务端返回的数据(调试用)
               
               if (result.code == 1) {
                    layer.msg("根据你输入的信息，首重价格为:"+result.data.firstPrice+"元<br>续重价格为:"+result.data.continuation+"元<br>总计为:"+result.data.sumPrice+"元")
                   
               }else if(result.code == 2){
                    layer.msg("无效的地址")
               }
               
           },
           error : function() {
               layer.msg("网络繁忙,请稍后再试");
           }
       });
    })
     
</script>

</body>
</html>